/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 布局容器 */
.layout-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 顶部导航栏 */
.top-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0 30px;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1000;
}

.header-left .project-name {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 1px;
}

/* 用户菜单 */
.user-menu {
    position: relative;
}

.user-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
}

.user-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.3s ease;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #667eea;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
}

/* 主容器 */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧导航栏 */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    margin: 10px;
}

/* 用户信息区域 */
.user-profile {
    padding: 20px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.avatar {
    margin-bottom: 12px;
}

.avatar i {
    font-size: 50px;
}

.user-info {
    text-align: center;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-id {
    font-size: 12px;
    opacity: 0.9;
}

/* 分隔线 */
.divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 0;
}

.nav-menu {
    list-style: none;
    padding: 20px 0;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    color: #555;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.nav-link:hover {
    background-color: #f8f9fa;
    color: #667eea;
    border-left-color: #667eea;
}

.nav-item.active .nav-link {
    background-color: #f0f4ff;
    color: #667eea;
    border-left-color: #667eea;
    font-weight: 600;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.nav-link span {
    font-size: 15px;
}

/* 右侧内容区 */
.content-area {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
}

.content-wrapper {
    padding: 30px;
    min-height: 100%;
}

/* 页面内容样式 */
.page-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.5s ease;
}

.page-header {
    margin-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.page-description {
    color: #666;
    font-size: 16px;
}

/* 卡片网格布局 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.card-content {
    color: #666;
    line-height: 1.6;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    
    .nav-link span {
        display: none;
    }
    
    .nav-link {
        justify-content: center;
        padding: 15px;
    }
    
    .top-header {
        padding: 0 15px;
    }
    
    .project-name {
        font-size: 18px;
    }
    
    .content-wrapper {
        padding: 15px;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 个人用户信息页面样式 */
.profile-container {
    width: 100%;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.profile-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-tabs {
    background: white;
    border-radius: 8px;
    padding: 5px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tab-buttons {
    display: flex;
    gap: 5px;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.tab-btn:hover {
    background-color: #f8f9fa;
    color: #667eea;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.profile-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.user-info-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.info-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.info-label {
    width: 100px;
    font-weight: 600;
    color: #666;
}

.info-value {
    flex: 1;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.edit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.edit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.add-unit-btn {
    background: #f0f4ff;
    color: #667eea;
    border: 1px solid #667eea;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.add-unit-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.unit-display {
    margin-top: 5px;
    font-style: italic;
    color: #666;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 20px;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    accent-color: #667eea;
}

/* 其他标签页样式 */
.avatar-section,
.password-section,
.delete-section,
.language-section {
    padding: 20px 0;
}

.avatar-section h3,
.password-section h3,
.delete-section h3,
.language-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.avatar-preview {
    width: var(--avatar-size, 120px);
    height: var(--avatar-size, 120px);
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid #e6e6e6;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
    transition: transform .2s ease, box-shadow .2s ease;
}

.avatar-preview:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(102, 126, 234, 0.22);
}

/* 头像图层（使用背景图） */
#avatar-icon {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

/* 覆盖层（悬停显示，上传中常显） */
.avatar-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
    background: linear-gradient(transparent 40%, rgba(0,0,0,0.45));
    opacity: 0;
    transition: opacity .2s ease;
}

.avatar-preview:hover .avatar-overlay { opacity: 1; }
.avatar-preview.uploading .avatar-overlay { opacity: 1; background: rgba(0,0,0,0.5); }
.avatar-overlay i { margin-right: 6px; }

/* 原图标样式保留，但不用于背景图显示 */
.avatar-preview i {
    font-size: 60px;
    color: white;
}

/* 格式提示样式 */
.format-tip {
    text-align: center;
    color: #666;
    font-size: 13px;
    margin-top: 10px;
}

.avatar-upload {
    display: block;
    margin: 20px auto;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.save-avatar-btn,
.save-password-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.save-avatar-btn:hover,
.save-password-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #666;
}

.form-group input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
}

.warning-text {
    color: #e74c3c;
    font-weight: 500;
    margin-bottom: 20px;
    padding: 15px;
    background: #fee;
    border-radius: 6px;
    border-left: 4px solid #e74c3c;
}

.delete-account-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.delete-account-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.language-options {
    display: flex;
    gap: 20px;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .tab-buttons {
        flex-wrap: wrap;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .info-label {
        width: auto;
        margin-bottom: 8px;
    }
    
    .language-options {
        flex-direction: column;
    }
}
/* Utility gradients for card icons */
.bg-grad-1 { background: linear-gradient(135deg, #667eea, #764ba2); }
.bg-grad-2 { background: linear-gradient(135deg, #f093fb, #f5576c); }
.bg-grad-3 { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.bg-grad-4 { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.bg-grad-5 { background: linear-gradient(135deg, #fa709a, #fee140); }
.bg-grad-6 { background: linear-gradient(135deg, #a8edea, #fed6e3); }

/* Utility containers */
.panel { margin-top: 20px; padding: 20px; background: #f8f9fa; border-radius: 8px; }

/* Users management toolbar and inputs */
.toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.input { padding:8px 10px; border:1px solid #ddd; border-radius:6px; }
.select { padding:8px 10px; border:1px solid #ddd; border-radius:6px; }
.btn { padding:8px 12px; border-radius:6px; cursor:pointer; }
.btn-primary { background:#4a90e2; color:#fff; border:none; }
.btn-outline { background:#fff; color:#333; border:1px solid #ddd; }
.btn-danger { background:#ffecec; color:#d93025; border:1px solid #ffcccc; }

/* Table */
.table-wrapper { margin-top:12px; overflow:auto; border:1px solid #f1f1f1; border-radius:8px; }
.table-basic { width:100%; border-collapse:collapse; }
.table-basic th, .table-basic td { padding:10px; border-bottom:1px solid #eee; text-align:left; }
.table-basic td .avatar { width:24px; height:24px; border-radius:50%; background-position:center; background-size:cover; background-repeat:no-repeat; }
.table-empty { padding:12px; color:#999; }

/* Modal */
.modal-overlay { position:fixed; left:0; top:0; width:100%; height:100%; background:rgba(0,0,0,0.35); display:flex; align-items:center; justify-content:center; z-index:1000; }
.modal-content { width:520px; background:#fff; border-radius:10px; box-shadow:0 6px 24px rgba(0,0,0,0.18); }
.modal-header { padding:14px 16px; border-bottom:1px solid #eee; display:flex; align-items:center; justify-content:space-between; }
.modal-header h3 { margin:0; font-size:18px; }
.modal-body { padding:16px; }
.modal-row { display:grid; grid-template-columns:120px 1fr; gap:10px; align-items:center; margin-bottom:10px; }
.modal-footer { padding:12px 16px; border-top:1px solid #eee; display:flex; justify-content:flex-end; gap:8px; }
.modal-close { border:none; background:transparent; font-size:20px; cursor:pointer; }
.form-feedback { margin-top:8px; font-size:13px; color:#666; }
.form-feedback.error { color:#d93025; }
.form-feedback.success { color:#126d00; }
.form-feedback.info { color:#666; }
.flex-1 { flex:1; }
.min-w-200 { min-width:200px; }
.modal-footer { padding:12px 16px; border-top:1px solid #eee; display:flex; justify-content:flex-end; gap:8px; }

/* Pagination */
.pagination-bar { display:flex; align-items:center; justify-content:space-between; margin-top:12px; }
.page-info { color:#666; font-size:13px; }
.btn-page { padding:6px 10px; border:1px solid #ddd; border-radius:6px; background:#fff; cursor:pointer; }

/* Small utilities */
.hidden { display: none !important; }
.actions-bar { text-align: right; margin-bottom: 10px; }

/* Page: Home */
.header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 15px 0; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); }
.header .container { display:flex; justify-content:space-between; align-items:center; }
.header h1 { font-size:24px; margin:0; font-weight:600; }
.user-info { display:flex; align-items:center; }
.user-info .avatar { width:40px; height:40px; border-radius:50%; background-color:rgba(255,255,255,0.2); display:flex; align-items:center; justify-content:center; margin-right:10px; overflow:hidden; }
.user-info .avatar i { width:100%; height:100%; display:block; border-radius:50%; background-position:center; background-size:cover; background-repeat:no-repeat; }
.user-info .user-details { text-align:right; }
.user-info .user-name { font-size:14px; font-weight:500; margin:0; }
.user-info .user-role { font-size:12px; opacity:0.9; margin:0; }
.content { padding:40px 0; }
.welcome-card { background:#fff; border-radius:12px; box-shadow:0 4px 20px rgba(0,0,0,0.05); padding:30px; margin-bottom:30px; text-align:center; }
.welcome-card h2 { font-size:28px; color:#333; margin-bottom:10px; }
.welcome-card p { font-size:16px; color:#666; margin-bottom:20px; }
.stats-cards, .action-cards { display:grid; grid-template-columns:repeat(auto-fit, minmax(250px, 1fr)); gap:20px; }
.stat-card, .action-card { background:#fff; border-radius:12px; box-shadow:0 4px 20px rgba(0,0,0,0.05); padding:25px; transition:transform .3s, box-shadow .3s; border:1px solid #e0e0e0; }
.stat-card:hover, .action-card:hover { transform:translateY(-5px); box-shadow:0 6px 25px rgba(0,0,0,0.1); }
.stat-icon { font-size:32px; color:#667eea; margin-bottom:15px; }
.stat-value { font-size:36px; font-weight:700; color:#333; margin-bottom:5px; }
.stat-label { font-size:14px; color:#666; }
.action-icon { font-size:40px; color:#667eea; margin-bottom:15px; }
.action-card h3 { font-size:18px; color:#333; margin-bottom:10px; }
.action-card p { font-size:14px; color:#666; margin-bottom:20px; }
.btn-outline-primary { color:#667eea; border-color:#667eea; border-radius:6px; padding:8px 20px; font-size:14px; transition:all .3s; }
.btn-outline-primary:hover { background-color:#667eea; color:#fff; }
.btn-logout { background:transparent; border:1px solid white; color:white; border-radius:6px; padding:6px 15px; font-size:14px; margin-left:20px; transition:all .3s; }
.btn-logout:hover { background:white; color:#667eea; }
@media (max-width: 768px) {
  .header .container { flex-direction: column; text-align:center; }
  .user-info { margin-top: 15px; }
  .btn-logout { margin-left: 0; margin-top: 10px; }
}

/* Page: Login */
.login-container { background:#fff; border-radius:12px; box-shadow:0 4px 20px rgba(0,0,0,0.1); overflow:hidden; max-width:900px; width:100%; margin:auto; }
.left-section { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color:white; padding:40px; display:flex; flex-direction:column; justify-content:center; }
.left-section h2 { font-size:24px; font-weight:600; margin-bottom:20px; }
.left-section p { font-size:14px; opacity:0.9; margin-bottom:30px; }
.illustration { text-align:center; margin-top:20px; }
.right-section { padding:40px; }
.right-section h3 { font-size:20px; font-weight:600; margin-bottom:30px; color:#333; }
.nav-tabs { border-bottom:none; margin-bottom:20px; }
.nav-tabs .nav-item .nav-link { color:#666; border:none; font-size:16px; padding:10px 0; margin-right:30px; }
.nav-tabs .nav-item .nav-link.active { color:#667eea; border-bottom:2px solid #667eea; }
.form-group { margin-bottom:20px; }
.form-group label { font-size:14px; color:#666; margin-bottom:8px; }
.form-control { border:1px solid #e0e0e0; border-radius:6px; padding:12px 15px; font-size:14px; transition:border-color .3s; }
.form-control:focus { border-color:#667eea; box-shadow:0 0 0 2px rgba(102,126,234,.1); }
.input-group-text { background-color:transparent; border:1px solid #e0e0e0; border-right:none; border-radius:6px 0 0 6px; color:#666; }
.input-group .form-control { border-left:none; border-radius:0 6px 6px 0; }
.btn-primary { background-color:#667eea; border:none; border-radius:6px; padding:12px; font-size:16px; font-weight:500; transition:background-color .3s; }
.btn-primary:hover { background-color:#5a6fe0; }
.form-footer { margin-top:20px; text-align:center; font-size:14px; color:#666; }
.form-footer a { color:#667eea; text-decoration:none; }
.form-footer a:hover { text-decoration:underline; }
.toggle-password { cursor:pointer; }
.messages { margin-bottom:20px; }
.alert { border-radius:6px; font-size:14px; }
.form-footer a { color:#667eea; text-decoration:none; }
.form-footer a:hover { text-decoration:underline; }
.toggle-password { cursor:pointer; }
.messages { margin-bottom:20px; }
.alert { border-radius:6px; font-size:14px; }
/* Toggle switch */
.toggle-switch { position:relative; display:inline-block; width:44px; height:24px; }
.toggle-switch input { opacity:0; width:0; height:0; position:absolute; }
.toggle-slider { position:absolute; cursor:pointer; inset:0; background:#ddd; transition:.2s; border-radius:24px; }
.toggle-slider:before { content:""; position:absolute; height:18px; width:18px; left:3px; top:3px; background:#fff; transition:.2s; border-radius:50%; box-shadow:0 1px 3px rgba(0,0,0,0.2); }
.toggle-switch input:checked + .toggle-slider { background:#4a90e2; }
.toggle-switch input:checked + .toggle-slider:before { transform:translateX(20px); }
.toggle-switch.disabled .toggle-slider, .toggle-switch input:disabled + .toggle-slider { opacity:.6; cursor:not-allowed; }
.btn-primary:hover { background-color:#5a6fe0; }
.form-footer a { color:#667eea; text-decoration:none; }
.form-footer a:hover { text-decoration:underline; }
.toggle-password { cursor:pointer; }
.messages { margin-bottom:20px; }
.alert { border-radius:6px; font-size:14px; }